#include<iostream>
using namespace std;
const int N = 1e5 + 10;
double arr[N], s[N];
int n, m;
bool check(double x)
{
	double sum = 0;
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		s[i] = s[i - 1] + arr[i] - x;
	}
	double mi = 0;
	for (int i = m, j = 0; i <= n; i++, j++) {
		mi = min(mi, s[j]);
		if (s[i] >= mi)return 1;
	}
	return 0;
}
int main()
{
	cin >> n >> m;
	double l = 0, r = 0;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
		r = max(r, arr[i]);
	}
	while (r - l >= 1e-5) {
		double mid = (l + r) / 2;
		if (check(mid))l = mid;
		else r = mid;
	}
	cout << (int)(r * 1000) << endl;
	return 0;
}